package com.commpany.servie.basic.clickhistory.converter;

import java.util.ArrayList;
import java.util.List;
import java.lang.reflect.Field;
import com.commpany.servie.basic.clickhistory.model.dto.clickhistory.ClickHistoryDTO;
import com.commpany.servie.basic.clickhistory.po.ClickHistoryPO;

/**
 * DTO和PO相互转换工具类
 * 
 * @author test
 * @date 2020-01-02 17:39:56
 */
public class ClickHistoryConverter {
	
	public static ClickHistoryDTO toDTO(ClickHistoryPO src) {
	if(src==null) return null;
		ClickHistoryDTO  tar = new ClickHistoryDTO();

		tar.setId(src.getId());
		tar.setUserId(src.getUserId());
		tar.setProductId(src.getProductId());
		return tar;
	}

	public static ClickHistoryPO toPO(ClickHistoryDTO src) {
	if(src==null) return null;
		ClickHistoryPO  tar = new ClickHistoryPO();

		tar.setId(src.getId());
		tar.setUserId(src.getUserId());
		tar.setProductId(src.getProductId());
		return tar;
	}

	public static List<ClickHistoryDTO> toDTO(List<ClickHistoryPO> srcs) {
		if (srcs == null)
			return null;
		List<ClickHistoryDTO> list = new ArrayList<ClickHistoryDTO>();
		for (ClickHistoryPO src : srcs) {
			list.add(toDTO(src));
		}
		return list;
	}

	public static List<ClickHistoryPO> toPO(List<ClickHistoryDTO> srcs) {
		if (srcs == null)
			return null;
		List<ClickHistoryPO> list = new ArrayList<ClickHistoryPO>();
		for (ClickHistoryDTO src : srcs) {
			list.add(toPO(src));
		}
		return list;
	}
}
	